package org.fall.mvc.controller;

import org.entity.Admin;
import org.fall.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class TestController {

    @Autowired
    private AdminService adminService;
    @RequestMapping("/send/array.html")
    @ResponseBody
    public String testReceiveArrayOne(@RequestParam("array") List<Integer> array){
        for(Integer num : array){
            System.out.println("num:"+num);
        }
        return "success";
    }
    @RequestMapping("/test/ssm.html")
    public String testSSM(ModelMap modelMap){

        List<Admin> adminList = adminService.getAll();
        modelMap.addAttribute("adminList",adminList);
        System.out.println(10/0);
        return "target";
    }
}
